package com.main.hotel.controller;

import com.main.hotel.entity.Customer;
import com.main.hotel.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * @author 莫浚洋
 */

@Controller
public class ManageController {

    @Autowired
    public ManageService manageService;
    @RequestMapping(value = "manage/findall",method = RequestMethod.GET)
    @ResponseBody
    public Page<Customer> findAllRoomType(Integer page, HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin","*");
        if(page==null||page<=0){
            page=0;
        }else{
            page-=1;
        }
        return manageService.findAll(page,3);
    }
}
